{% from "../../macros/attributes.njk" import govukAttributes -%}

<fieldset class="govuk-fieldset
  {%- if params.classes %} {{ params.classes }}{% endif %}"
  {%- if params.role %} role="{{ params.role }}"{% endif %}
  {%- if params.describedBy %} aria-describedby="{{ params.describedBy }}"{% endif %}
  {{- govukAttributes(params.attributes) }}>
  {% if params.legend.html or params.legend.text %}
  <legend class="govuk-fieldset__legend {%- if params.legend.classes %} {{ params.legend.classes }}{% endif %}">
  {% if params.legend.isPageHeading %}
    <h1 class="govuk-fieldset__heading">
      {{ params.legend.html | safe | trim | indent(6) if params.legend.html else params.legend.text }}
    </h1>
  {% else %}
    {{ params.legend.html | safe | trim | indent(4) if params.legend.html else params.legend.text }}
  {% endif %}
  </legend>
  {% endif %}
{% if caller %} {#- if statement allows usage of `call` to be optional -#}
  {{ caller() }}
{% elseif params.html %}
  {{ params.html | safe }}
{% endif %}
</fieldset>
